package com.phms.model;

import org.springframework.stereotype.Component;

import java.util.HashMap;

/**
 * 返回前台结果
 */
@Component
public class ResultMap extends HashMap<String, Object> {
	/**
	 * 定义一个类型为 long 的字段 serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	public ResultMap() {
	}

	/**
	 * 操作成功
	 */
	public ResultMap success() {
		this.put("result", "success");
		return this;
	}

	/**
	 * 操作失败
	 */
	public ResultMap fail() {
		this.put("result", "fail");
		return this;
	}

	/**
	 * 返回前台信息
	 */
	public ResultMap message(Object message) {
		this.put("message", message);
		return this;
	}
}